package com.kg.fiber.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ivan.toolkit.common.Aniout;
import com.kg.fiber.service.pcie8622.Pcie8622Config;

@Controller
@RequestMapping("/pcie8622")
@ResponseBody
public class Pcie8622Controller {
	
	/*
	@Autowired
	private Pcie8622 pcie8622;
	
	@RequestMapping(value = "/getPciState.do")
	public Anival getPci1714State() {
		Anival av = new Anival();
		//av.put("state", pci1714.isStarted() ? "运行" : "停止");
		//av.put("status", pci1714.getStatus());
		return av;
	}
	
	@RequestMapping(value = "/getPciRuntime.do")
	public Anival getPci1714Runtime() {
		//return pci1714.getRuntime();
		return new Anival();
	}
	*/
	
	@RequestMapping(value = "/getConfig.do")
	public Pcie8622Config getConfig() {
		return Pcie8622Config.instance.get();
	}
	
	@RequestMapping(value = "/setConfig.do")
	public Aniout setPciConfig(Pcie8622Config config) {
		try {
			Pcie8622Config.instance.set(config);
			return Aniout.success();
		} catch (Exception e) {
			return Aniout.failure().message("Exception: " + e.getMessage());
		}
	}
	
}
